<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>

    <title>个人项目立项新增/修改弹窗页面</title>

    <div th:replace="common/common.html :: common_resource"></div>

</head>

<body class="gray-bg">

<div th:fragment="addProject">
<div id="modal-form-user" class="modal fade" aria-hidden="true">
    <div class="modal-dialog" style="width:64%;">
        <div class="modal-content">
            <div class="modal-body">
                <div class="row">
                    <div class="col-sm-2 b-r"></div>
                    <div class="col-sm-5 b-l">
                        <form th:action="@{/project/addEditProject(projectState=2)}" method="post" enctype="multipart/form-data">

                            <!-- 项目立项信息 -->
                            <h3 class="m-t-none m-b" style="margin-bottom:30px"><i class="fa fa-paste"></i> 个人项目立项信息填写</h3>
                            <div class="form-group">
                                <label>项目编号：</label>
                                <input type="text" id="projectIdUser" name="projectId" placeholder="请输入项目编号" class="form-control">
                            </div>
                            <div class="form-group">
                                <label>项目名称：</label>
                                <input type="text" id="projectNameUser" name="projectName" placeholder="请输入项目名称" class="form-control">
                            </div>
                            <div class="form-group">
                                <label class="control-label">竞赛类型：</label>
                                <div>
                                    <select class="form-control">
                                        <option value="1">数学竞赛</option>
                                        <option value="2">大学生创新创业竞赛</option>
                                        <option value="3">大学生设计大赛</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label>请选择项目类型：</label>
                                <div>
                                    <label class="radio-inline">
                                        <input style="margin-top:2px;" type="radio" value="1" id="projectStateUser1" name="projectState">团队项目</label>
                                    <label class="radio-inline">
                                        <input style="margin-top:2px;" type="radio" value="2" id="projectStateUser2" name="projectState">个人项目</label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label>学号(个人竞赛)：</label>
                                <input type="text" id="stuNoUser" name="stuNo" placeholder="请输入学号" class="form-control">
                            </div>
                            <div class="form-group">
                                <label class="control-label">指导老师：</label>
                                <div>
                                    <select class="form-control" id="instructorIdUser" name="instructorId">
                                        <option id="selectsUser" value="">请选择指导老师</option>
                                        <span th:each="instructor : ${instructorList}">
                                            <option th:id="${instructor.getInstructorId()}" th:value="${instructor.getInstructorId()}"
                                                    th:text="${instructor.getInstructorName()}" hassubinfo="true">文本</option>
                                        </span>
                                    </select>
                                </div>
                            </div>

                            <!-- 经费预算 -->
                            <h3 class="m-t-none m-b" style="margin-bottom:30px;margin-top:50px;"><i class="fa fa-paste"></i> 个人经费预算信息填写</h3>
                            <div class="form-group">
                                <label>经费预算编号：</label>
                                <input type="text" id="fundsIdUser" name="fundsId" placeholder="请输入经费预算编号" class="form-control">
                            </div>
                            <div class="form-group">
                                <label class="control-label">本年度指标：</label>
                                <div>
                                    <select class="form-control" id="budgetId" name="budgetId">
                                        <option id="selectBudget" value="">请选择指标</option>
                                        <span th:each="budget : ${budgetList}">
                                            <option th:id="${budget.getBudgetId()}" th:value="${budget.getBudgetId()}" th:text="${budget.getBudgetName()}" hassubinfo="true">文本</option>
                                        </span>
                                    </select>
                                </div>
                            </div>
                            <script th:inline="javascript">
                                $("#budgetId").blur(function(){   // 根据选择的省查询下面的市
                                    var budgetId = $('#budgetId option:selected').val();  // 获取选择的值
                                    var budgetList = [[${budgetList}]];
                                    for(var i=0; i<budgetList.length; i++){
                                        if(budgetList[i].budgetId == budgetId){
                                            document.getElementById("fundsMoneyUser").value = budgetList[i].budgetMoney;
                                        }
                                    }
                                })
                            </script>
                            <div class="form-group">
                                <label>预算金额：</label>
                                <input type="text" id="fundsMoneyUser" name="fundsMoney" class="form-control" data-mask="&yen; 9,999.99" placeholder="" readonly="readonly">
                            </div>
                            <div class="form-group">
                                <label>参赛注册费：</label>
                                <input type="text" id="moneyOneUser" name="moneyOne" class="form-control" data-mask="&yen; 9,999.99" placeholder="" >
                            </div>
                            <div class="form-group">
                                <label>差旅费：</label>
                                <input type="text" id="moneyTwoUser" name="moneyTwo" class="form-control" data-mask="&yen; 9,999.99" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>培训费：</label>
                                <input type="text" id="moneyThreeUser" name="moneyThree" class="form-control" data-mask="&yen; 9,999.99" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>指导费：</label>
                                <input type="text" id="moneyFourUser" name="moneyFour" class="form-control" data-mask="&yen; 9,999.99" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>耗材费：</label>
                                <input type="text" id="moneyFiveUser" name="moneyFive" class="form-control" data-mask="&yen; 9,999.99" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>教师奖金：</label>
                                <input type="text" id="moneySixUser" name="moneySix" class="form-control" data-mask="&yen; 9,999.99" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>其它：</label>
                                <input type="text" id="moneyOtherUser" name="moneyOther" class="form-control" data-mask="&yen; 9,999.99" placeholder="">
                            </div>
                            <div class="form-group">
                                <label>总金额：</label>
                                <input type="text" id="moneyAllUser" name="moneyAll" class="form-control" data-mask="&yen; 9,999.99" placeholder="">
                            </div>

                            <script th:inline="javascript">
                                $('#moneyOneUser, #moneyTwoUser, #moneyThreeUser, #moneyFourUser, #moneyFiveUser, #moneySixUser, #moneyOtherUser')
                                        .bind('input propertychange', function() {
                                    var moneyOne = document.getElementById("moneyOneUser").value;
                                    var moneyTwo = document.getElementById("moneyTwoUser").value;
                                    var moneyThree = document.getElementById("moneyThreeUser").value;
                                    var moneyFour = document.getElementById("moneyFourUser").value;
                                    var moneyFive = document.getElementById("moneyFiveUser").value;
                                    var moneySix = document.getElementById("moneySixUser").value;
                                    var moneyOther = document.getElementById("moneyOtherUser").value;
                                    document.getElementById("moneyAllUser").value =
                                            Number(moneyOne) + Number(moneyTwo) + Number(moneyThree) + Number(moneyFour) +
                                            Number(moneyFive) + Number(moneySix) + Number(moneyOther)
                                });
                            </script>

                            <div class="form-group">
                                <label>附件选择：</label>
                                <input type="file" name="file" class="form-control">
                            </div>

                            <div style="margin-top:20px;">
                                <button style="width:100px;margin-top:15px;margin-bottom:30px;"
                                        class="btn btn-sm btn-primary pull-left m-t-n-xs" type="submit">
                                    <strong>提交</strong>
                                </button>
                            </div>
                        </form>

                        <!-- 上传文件测试 -->
<!--                        <form th:action="@{/file/fileOn}" method="post" enctype="multipart/form-data">-->
<!--                            <div class="form-group">-->
<!--                                <label>文件选择：</label>-->
<!--                                <input type="file" name="file" class="form-control">-->
<!--                            </div>-->
<!--                            <div style="margin-top:20px;">-->
<!--                                <button style="width:100px;margin-top:15px;margin-bottom:30px;"-->
<!--                                        class="btn btn-sm btn-primary pull-left m-t-n-xs" type="submit">-->
<!--                                    <strong>提交</strong>-->
<!--                                </button>-->
<!--                            </div>-->
<!--                        </form>-->
                    </div>
                    <div class="col-sm-5 b-l"></div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>

</body>

</html>
